
  <link href="https://cdn.bootcss.com/twitter-bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet">
  <style>
    nav {
      background-color: lightblue;
      padding: 5px 0;
    }

    nav a {
      color: white;
      font-size: 17px;
    }

    nav ul li {
      width: 22%;
      text-align: center;
    }

    h1 {
      text-align: center;
    }
    .user{
      position: absolute !important;
      right: 90px;
      top: 20px;
      width: auto !important;
      font-size: 17px;
      line-height: 14px;
    }
  </style>

  <nav>
    <div class="container">
      <ul class="nav nav-pills">
        <li class="{{code=='index'?'active':''}}"><a href="/">首页</a></li>
        <li class="{{code=='tag'?'active':''}}"><a href="/tag">标签</a></li>
        {{if user}}
        <li class="{{code=='publish'?'active':''}}"><a href="/publish">发帖</a></li>
        <li><a href="/api/outLogin" class="outLogin">退出登陆</a></li>
        <li class="user">你好：{{user.account}}</li>
        {{else}}
        <li class="{{code=='login'?'active':''}}"><a href="/login">登陆</a></li>
        <li class="{{code=='register'?'active':''}}"><a href="/register">注册</a></li>
        {{/if}}
      </ul>
    </div>
  </nav>
  <h1>{{title}}</h1>
  
  
<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
<script>
    $('.outLogin').click(function(event){
      if(!confirm('确认要退出吗')){
        // 取消
        event.preventDefault();
      }
    })
</script>